%{
        if (_mainMenu != null && _mainMenu.size() > 0) {
            fw = _isAdmin ? 97 : 100;
            width = fw / _mainMenu.size();
            margin = width * 0.02;
            width = (fw - margin) / _mainMenu.size();
            width -= margin;
        }
}%
<header>
        <nav>
            %{ if (_isAdmin) { }%
                <a href="/admin/menueditor/new" class="menu-item-add">
                    <div class="ui-state-default ui-corner-all">
                        <span class="ui-icon ui-icon-circle-plus">+</span>
                    </div>
                </a>
            %{ } }%
            <ul class="menu">
                #{list items:_mainMenu, as:'item' }
                    <a href="${item.url}" class="menu-item">
                        <li style="border-color: #${item.color}; width: ${width}%;
                                   margin-left: ${margin}%;
                                   background-color: #${item.color}; ">
                            <span>${item.title}</span>
                        </li>
                    </a>
                #{/list}
            </ul>
        </nav>
</header>

